package com.ad_hccm.dao.DiseaseHistory;

import com.ad_hccm.domain.DiseaseHistory.ADFamilyHistory;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * TODO AD家族史Dao
 */
@Mapper
public interface ADFamilyHistoryDao {
    @Insert("insert into ad_family_history value(#{id}, #{parent}, #{twin}, #{sibling}, #{children}, #{grandparent}, #{grandparents}, #{uncleAunt}, #{auntieUncle}, #{nephew}, #{grandson}, #{grandchild}, #{fristCousins}, #{distantCousins})")
    public boolean save(ADFamilyHistory adFamilyHistory);

    @Update("update ad_family_history set parent = #{parent}, twin = #{twin}, sibling = #{sibling}, children = #{children}, grandparent = #{grandparent}, grandparents = #{grandparents}, uncleAunt = #{uncleAunt}, auntieUncle = #{auntieUncle}, nephew = #{nephew}, grandson = #{grandson}, grandchild = #{grandchild}, fristCousins = #{fristCousins}, distantCousins = #{distantCousins} where id=#{id}")
    public boolean update(ADFamilyHistory adFamilyHistory);

    @Select("select * from ad_family_history where id=#{id}")
    public ADFamilyHistory getById(String id);

    @Select("select * from ad_family_history")
    public List<ADFamilyHistory> getAll();
}